]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
HACKING.md: Update sample code to use paint context
authorJonas Ådahl <jadahl@gmail.com>
Thu, 28 Nov 2019 10:19:27 +0000 (11:19 +0100)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 3 Dec 2019 19:07:15 +0000 (19:07 +0000)
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/827

HACKING.md

index 05176c45f9a844bc117ba73192dc467cb008bf23..d1e23e03faaf45c59116cf45e830240fccef7dde 100644 (file)
@@ -163,11 +163,17 @@ you to inherit from a type to use it, you can do so:
              return [100, 100];
         }
 
-        vfunc_paint() {
+        vfunc_paint(paintContext) {
+             let framebuffer = paintContext.get_framebuffer();
+             let coglContext = framebuffer.get_context();
              let alloc = this.get_allocation_box();
-             Cogl.set_source_color4ub(255, 0, 0, 255);
-             Cogl.rectangle(alloc.x1, alloc.y1,
-                            alloc.x2, alloc.y2);
+
+             let pipeline = new Cogl.Pipeline(coglContext);
+             pipeline.set_color4ub(255, 0, 0, 255);
+
+             framebuffer.draw_rectangle(pipeline,
+                alloc.x1, alloc.y1,
+                alloc.x2, alloc.y2);
         }
     });
 ```